package com.xin.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.xin.pojo.User;
import com.xin.util.JsonUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author WYX
 * @create 2020-04-03-13:56
 */
@RestController
public class UserController {
    @RequestMapping("/j3")
    //@ResponseBody  //它就不会走视图解析器,会直接返回一个字符串
    public String test3() throws JsonProcessingException {
        Date date =new Date();
        //ObjectMapper，时间解析后的默认格式为：Timestamp，时间戳
        return JsonUtil.getJson(date,"yyyy-MM-dd HH:mm:ss");
    }
}
